# Build recipe for xdotool.
#
# Copyright (c) 2018 Markus Tornow, <tornow@riseup.net>.
# Copyright (c) 2018, 2020 Matias Fonzo, <selk@dragora.org>.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Exit immediately on any error
set -e

program=xdotool
version=3.20160805.1
release=1

# Define a category for the output of the package name
pkgcategory=x-apps

tarname=${program}-${version}.tar.gz

# Remote source(s)
fetch=https://github.com/jordansissel/xdotool/releases/download/v${version}/$tarname

homepage=https://www.semicomplete.com/projects/xdotool/

description="
Fake input from the mouse and keyboard very easily.

xdotool also supports window manager actions such as moving,
activating, and other actions on windows.

For more information, visit:
$homepage
"

homepage=https://www.semicomplete.com/projects/xdotool/
license=Custom

# Source documentation
docs="CHANGELIST COPYRIGHT README VERSION examples/"
docsdir="${docdir}/${program}-${version}"

build()
{
    unpack "${tardir}/$tarname"

    cd "$srcdir"

    make showman

    make -j${jobs} V=1 CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" \
          PREFIX=/usr \
          INSTALLLIB=/usr/lib${libSuffix} \
          INSTALLMAN=$mandir \
          LDCONFIG=true \
          DESTDIR="$destdir" \
          install

    lzip -9 "${destdir}/${mandir}/man1/xdotool.1"

    # Copy documentation
    mkdir -p "${destdir}${docsdir}"
    cp -p -r $docs "${destdir}${docsdir}/"
}

